package logicQuiz

import org.springframework.cloud.contract.spec.Contract

Contract.make {
    request {
        method("GET")
        url("/api/v3/logicQuizzesItem/examples")
    }
    response {
        status(200)
        body("""
            [{
                "id": 1,
                "initializedBox": "initializedBox",
                "stepsString": "stepsString",
                "count": 2,
                "questionZh": "questionZh",
                "stepsLength": 2,
                "maxUpdateTimes": 5,
                "descriptionZh": "descriptionZh",
                "chartPath": "chartPath",
                "infoPath": "infoPath",
            }]
            """)
        bodyMatchers {
            jsonPath('$[*]', byType())
            jsonPath('$[*].id', byRegex(number()))
            jsonPath('$[*].initializedBox', byRegex("[\\s\\S]+"))
            jsonPath('$[*].stepsString', byRegex("[\\s\\S]+"))
            jsonPath('$[*].count', byRegex(number()))
            jsonPath('$[*].questionZh', byRegex("[\\s\\S]+"))
            jsonPath('$[*].stepsLength', byRegex(number()))
            jsonPath('$[*].maxUpdateTimes', byRegex(number()))
            jsonPath('$[*].descriptionZh', byRegex("[\\s\\S]+"))
            jsonPath('$[*].chartPath', byRegex("[\\s\\S]+"))
            jsonPath('$[*].infoPath', byRegex("[\\s\\S]+"))
        }
        headers {
            contentType(applicationJsonUtf8())
        }
    }
}
